<?php


namespace app\index\controller;

use app\index\model\ChatUser as ChatUserModel;
class Chatuser extends Base
{
    public function get(){
        $user = new ChatUserModel();
        $data=$this->request->param();
        $r= $user->with('getUser,sendUser')->whereOr('get_u_id','=',$data['u_id'])
            ->whereOr('send_u_id','=',$data['u_id'])
            ->order('cTime desc')
            ->select();
        return $r;
    }
    public function update()
    {
        $data = $this->request->param();
        $res = new ChatUserModel();
        return $res->updateModel($data);
    }
    public function delete(){
        $data = $this->request->param();
        $res = new ChatUserModel();
        return $res->deleteModel($data);
    }
    public function save(){
        $res = new ChatUserModel();
        $data = $this->request->param();
        $res->reg($data);
    }
}